package edu.fiu.cis.personalize.server.graph.store;

import java.util.concurrent.ConcurrentHashMap;

@SuppressWarnings("serial")
public abstract class NullConcMap<K, V> extends
		ConcurrentHashMap<K, V> {

	@SuppressWarnings("unchecked")
	@Override
	public V get(Object key) {
		if (!containsKey(key)) {
			K k = (K) key;
			V value = createEmptyValue(k);
			put(k, value);
		}
		return super.get(key);
	}

	protected abstract V createEmptyValue(K key);

}
